<!--#include file="Config.asp" -->
<!--#include file="HeadTop.asp" -->
<%

UrlID=int(Request("id"))
ClassID=int(request("classid"))
ActionType=Trim(request("ActionType"))
KeyWords=Trim(request("KeyWords"))
Page=int(Request("Page"))
num_lie=5

set rs=server.createobject("adodb.recordset")

'Add
if ActionType="Add" or ActionType="" then
AName=Trim(session("AnyPIM_username"))&"快速增加"
AURL="UrlSave.asp?ActionType=AddUrlSave"
myUrl="http://"
end If

'Mod
if ActionType="Mod" and Request("id")<>"" then
AName=Trim(session("AnyPIM_username"))&"修改"
sql="select * from plan_URL where ID="&UrlID
rs.open sql,conn,1,1
Title=Trim(rs("title"))
ClassID=Trim(rs("ClassID"))
myURL=Trim(rs("myURL"))
rs.close
AURL="UrlSave.asp?ActionType=ModUrlSave&UrlID="&UrlID
end if

%>
<!-- 数据搜索 -->
<table class="table table-condensed table-striped">

<FORM METHOD=POST ACTION="?">
<TR>
<TD>
<INPUT TYPE="text" NAME="KeyWords" size='20' value='<%=KeyWords%>'>
<INPUT TYPE="submit" value='Find'>
</TD>
</FORM>
<!-- 增加以及修改 -->
<FORM METHOD=POST ACTION="<%=AURL%>">
<TD align='right'>
<SELECT NAME="ClassID">
<OPTION VALUE="0" <%If ClassID=0 then%>selected<%End if%>>=全部分类=</OPTION>
<%
SQLtargetsort="select * from Plan_UrlClass where userid="&session("AnyPIM_userID")&" and Type_FatherID<>0 order by Type_FatherID"
rs.open sqltargetsort,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=rs("Type_id")%>"<%If ClassID=int(rs("Type_id")) then%>selected<%End if%>><%=rs("Type_fatherid")%>.<%=rs("Type_id")%>.<%=trim(rs("Type_name"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>
</SELECT>
Title：<INPUT TYPE="text" NAME="title" size='30' value='<%=Title%>'>
URL：<INPUT TYPE="text" NAME="myURL" size='40' value='<%=myURL%>'>
<INPUT TYPE="submit" value='<%=AName%>'>
</TD>
</TR>
</FORM>
</TABLE>

<!-- 列表展示 -->
<table class="table table-condensed table-striped">
<TR bgcolor='#ffffff'>
<TD bgcolor='#ddeeff' width='150'  valign='top'>
<strong><a href="UrlClassAdmin.asp"><b>[分类管理]</b></a><br>
<a href="?ClassID=0"><b>[全部注册]</b></a><br>
<%
set rson=server.createobject("adodb.recordset")
rsonsql="select * from Plan_URLCLass where userid="&session("AnyPIM_userID")&" and type_fatherID<>0 order by type_id"
rson.open rsonsql,conn,1,1
for dd=1 to rson.recordcount
%>
<a href="?classid=<%=int(rson("type_id"))%>"><b>[<%=trim(rson("type_name"))%>]</b></a><br>
<%
rson.moveNext
Next
rson.close
%></strong>
</TD>
<!-- List -->
<TD valign='top'>
<table class="table table-condensed table-striped">
<%
sql="select * from plan_URL where userid='"&session("AnyPIM_userid")&"' "
if classid<>0 then
sql=sql&" and classid="&ClassID&" "
end If
if KeyWords<>"" then
sql=sql&" and Title like '%"&KeyWords&"%' "
end If
sql=sql&" order by ID desc"

rs.open sql,conn,1,1
If rs.recordcount<>0 then
   rs.PageSize =80
   If Page < 1 Then Page = 1
   If Page > rs.PageCount Then Page = rs.PageCount
   PageBegin=rs.PageSize*(Page-1)+1
  if rs.PageSize*PageN< rs.RecordCount then
    PageEnd=rs.PageSize * Page
  else
    PageEnd=rs.RecordCount
  end If
  maxpage=rs.pagecount
  rcount=rs.RecordCount
rs.AbsolutePage = Page
For iPage = 1 To rs.PageSize
%>
<tr>
<TD style="BORDER-bottom: #CCCCCC 1px solid;" style="cursor:hand" onmouseover="this.bgColor='#f6f6f6';" onmouseout="this.bgColor='';" valign='top' style="word-break:break-all" width='<%=100/num_lie%>%'>
<A HREF="UrlDetail.asp?UrlID=<%=int(rs("ID"))%>" target='_blank' >
<b><%=trim(rs("title"))%></b>.[<%=ShowURLCLassName(Trim(rs("classid")))%>]
</A>&nbsp;<A HREF="UrlEdit.asp?UrlID=<%=rs("ID")%>" title='Edit this url!' target='_blank'>[Edit]</A>
<br><A HREF="<%=Trim(rs("myurl"))%>" target='_blank' ><%=Trim(rs("myurl"))%></a>
<%
rs.MoveNext
if (iPage mod num_lie)=0 then
%>
</td>
<%
end if
If rs.EOF Then Exit For
Next
End if
rs.close
%>
</tr>

<tr>
<td colspan='<%=num_lie%>' style="BORDER-top: #CCCCCC 1px solid;BORDER-bottom: #CCCCCC 1px solid;" bgcolor='#f6f6f6'>

<%
  response.write "" & rcount & "/" & maxpage & ",当前显示<font color=red>第" & Page & "页</font>[<font color=red>第" & PageBegin & "条-第" & PageEnd & "条</font>]"%>
<%=Page%>/<%=maxpage%>
<%If Page <> 1 Then ' 如果不是位于第一页 %>
     <A HREF='?Page=1&Classid=<%=classid%>'>[第一页]</A>
     <A HREF='?Page=<%=(Page-1)%>&Classid=<%=classid%>'>[上一页]</A>
<%End If
  If Page <> maxpage Then ' 如果不是位于最后一页
%>
  <A HREF='?Page=<%=(Page+1)%>&Classid=<%=classid%>'>[下一页]</A>
  <A HREF='?Page=<%=maxpage%>&Classid=<%=classid%>'>[最后页]</A>
<%End If%>
</FONT>
</td>
</tr>
</TABLE>

</TD>
<!-- List -->
</TR>
</TABLE>



<!-- #include file="Foot.asp" -->